package cn.ronghuanet;

import cn.ronghuanet.auth.interceptor.AuthInterceptor;
import org.mybatis.spring.annotation.MapperScan;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;
import org.springframework.boot.web.servlet.ServletComponentScan;
import org.springframework.web.servlet.config.annotation.InterceptorRegistry;
import org.springframework.web.servlet.config.annotation.WebMvcConfigurer;

/**
 * 启动类
 */
@SpringBootApplication
@MapperScan("cn.ronghuanet.*.mapper")   // 用来扫描mapper包下接口的,将接口生成的代理类交给spring管理
@ServletComponentScan("cn.ronghuanet.auth.listener")    // 去扫描我们的监听器
public class AppStart implements WebMvcConfigurer {

    public static void main(String[] args) {
        SpringApplication.run(AppStart.class,args);
    }

    @Autowired
    private AuthInterceptor authInterceptor;

    /*@Override
    public void addInterceptors(InterceptorRegistry registry) {
        registry.addInterceptor(authInterceptor)
                .addPathPatterns("/**")
                .excludePathPatterns("/login");
    }*/
}
